// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Vertical Door Object
// Script Author: Christan Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 61 : TYPE_VERTICALDOOR

// Function declarations
reserve function VerticalDoor_DebugDraw
reserve function VerticalDoor_DebugSpawn

// Static Values

// Tables

function VerticalDoor_DebugDraw
	DrawSprite(0)
end function


function VerticalDoor_DebugSpawn
	CreateTempObject(TypeName[Vertical Door], 0, object.xpos, object.ypos)
end function


event ObjectMain
	switch object.state
	case 0
		if object[-1].propertyValue == 1
			object.state = 1
		end if
		break
	case 1
		if object.value0 < 0x400000
			object.value0 += 0x20000
			object.ypos -= 0x20000
		else
			object.state++
		end if
		break
	end switch
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_BOX, object.entityPos, -16, -32, 16, 32, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
	next
end event


event ObjectDraw
	DrawSprite(0)
end event


event ObjectStartup
	LoadSpriteSheet("SYZ/Objects.gif")
	SpriteFrame(-16, -32, 32, 64, 119, 34)
	SetTableValue(TypeName[Vertical Door], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(VerticalDoor_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(VerticalDoor_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
